package com.example.administrator.q1;

import android.provider.Contacts;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.GridView;

import java.util.ArrayList;
import java.util.List;

public class GridActivity extends AppCompatActivity {

    GridView gridView;
    List<People> list = new ArrayList<People>();

    int[] images = new int[]{R.mipmap.ic_launcher_round,R.mipmap.ic_launcher_round,R.mipmap.ic_launcher_round,R.mipmap.ic_launcher_round,R.mipmap.ic_launcher_round,R.mipmap.ic_launcher_round,R.mipmap.ic_launcher_round,R.mipmap.ic_launcher_round,R.mipmap.ic_launcher_round,R.mipmap.ic_launcher_round,R.mipmap.ic_launcher_round,R.mipmap.ic_launcher_round,R.mipmap.ic_launcher_round,R.mipmap.ic_launcher_round,R.mipmap.ic_launcher_round,R.mipmap.ic_launcher_round};
    String [] name= {"Android", "Android", "Android", "Android", "Android", "Android", "Android", "Android", "Android","Android", "Android", "Android", "Android", "Android", "Android", "Android"};

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_grid);

        gridView = (GridView) findViewById(R.id.gridView);

        for (int i = 0; i < images.length; i++) {
            People people = new People();
            people.setName(name[i]);
            people.setImg(images[i]);
            list.add(people);
        }

        MyGridViewAdapter myGridViewAdapter = new MyGridViewAdapter(GridActivity.this, list);

        gridView.setAdapter(myGridViewAdapter);
    }
}
